package insight.google.game.era.data;


import insight.google.game.era.core.hub.UserPendingEvents;

import java.util.ArrayList;
import java.util.List;

import com.google.appengine.api.datastore.Key;


public class PendingEventDataManager extends AppDataManager {

	public PendingEventDataManager(){
		super.initialize();
	}
	
	@Override
	public boolean addToDataStore(Object o) {
//		User user = (User)o;
//		user.setScriptProxy(null);
//		dataStoreMgr.save(o);
		return false;
	}

	@Override
	public ArrayList<UserPendingEvents> findAll() {
		//List<UserPendingEvents> userList = (List<UserPendingEvents>)dataStoreMgr.get(UserPendingEvents.class);;
		return null;//new ArrayList<UserPendingEvents>(userList);
		//return null;
	}
	
	
	public UserPendingEvents findById(Key userId) {
		return null; //(User)DataStoreManager.getInstance().getById(UserPendingEvents.class, userId);
//		StringBuffer cond = new StringBuffer();
//		cond.append("id == '" + userId + "'");
//		return getSingleUser(cond.toString());
		
	}
	
	public List<User> findAllByRoomId(Key roomId) {
		StringBuffer cond = new StringBuffer();
		cond.append("roomId == '" + roomId + "'");
		return null;//(List<User>)DataStoreManager.getInstance().getByCondition(User.class, cond.toString());
		
	}
	
	private User getSingleUser(String cond){
		User user = null;
		List<User> userList = null;//DataStoreManager.getInstance().getByCondition(User.class, cond);

		if (userList != null) {
			for (int i = 0; i < userList.size(); i++) {
				user = (User)userList.get(i);
				break;
			}
		}
		return user;
	}

//	@Override
//	public boolean removeDataStore() {
//		return DataStoreManager.getInstance().delete(user);
//		
//	}

//	public boolean removeDataStore(User user) {
//		return DataStoreManager.getInstance().delete(user);
//		
//	}

	
}
